﻿using System;
using System.Collections.Generic;
using System.Text;

using ECCIT;
using ECCIT.Data;
using OgilvyOne.Model;
using OgilvyOne.SqlServerDAL;
using OgilvyOne.UKNow.Model;
using OgilvyOne.UKNow.Utility;
using System.Data;

namespace OgilvyOne.UKNow.IDAL
{
    public interface IDALEvents 
    {
        #region 获取数据接口
        /// <summary>
        ///     根据活动ID和语言类型获取活动对象
        /// </summary>
        /// <param name="languageID">语言类型ID</param>
        /// <param name="id">活动ID</param>
        /// <returns>如果存在，返回EventsModel，如果不存在，返回null</returns>
        EventsModel GetEventsModelByID(int? id);
        
        /// <summary>
        ///     获取活动所有数据，默认根据最后修改时间倒排序
        /// </summary>
        /// <returns></returns>
        IList<EventsModel> GetAllEventsModels();

        /*修改人：穆凤凤
        * 修改时间：2012-03-08
        * 修改内容：
        *      新增接口 获得按活动语言和名称查询出的实体 GetEventModelsByName
        *      有mff注释的为本次修改的代码
        */
        //mff
        /// <summary>
        ///     根据活动语言，获得活动实体,用于图片和视频的同步
        /// </summary>
        /// <returns></returns>
        List<EventsModel> GetEventModelsByName( int langid);

        /// <summary>
        ///     根据活动语言和活动名称，获得活动实体,用于图片和视频的同步
        /// </summary>
        /// <returns></returns>
        IList<EventsModel> GetEveByNandL(int langid,string eventName );
        //mff
        /// <summary>
        ///     获取活动所有数据，默认根据最后修改时间倒排序
        /// </summary>
        /// <returns></returns>
        IList<EventsModel> GetAllEventsModels( int isSpecial);

        /*修改人：穆凤凤
        * 修改时间：2012-03-05
        * 修改内容：
        *      新增接口 获得按姓名查找出来的活动实体 GetEventsModelByName
        *      有mff注释的为本次修改的代码
        */
        //mff
        /// <summary>
        ///     获取按活动名称搜索出来的活动数据
        /// </summary>
        /// <returns></returns>
        IList<EventsModel> GetEventsModelByName(string ename,int? state,int? isspecial);
        //mff
        
        ///     获取已发布的活动数据，默认根据最后修改时间倒排序
        /// </summary>
        /// <returns></returns>
        IList<EventsModel> GetPublishedEventsModels(int isSpecial);

        /// <summary>
        ///     根据不同的筛选条件获取符合条件的活动数据，默认按照活动举办时间倒排序
        /// </summary>
        /// <param name="artFormID">活动艺术形式，如果为null，表示全部艺术形式</param>
        /// <param name="date">活动举办日期，如果为null，表示全部日期</param>
        /// <param name="cityID">活动举办城市，如果为null，表示全部城市</param>
        /// <returns></returns>
        PagingList GetFilteredEventsModels(int cityID, int artFormID, string yearMonth, int date, PagingParameter pagingParams);

        /// <summary>
        ///     获取活动行程首页的默认活动列表数据，根据用户所在城市列出将要举办的和正在举办的活动，最后显示已经结束的活动
        ///     如果用户所在城市没有活动，那么默认按照时间先后顺序降序显示所有活动
        /// </summary>
        /// <param name="cityID"></param>
        /// <returns></returns>
        PagingList GetCalendarDefaultEvents(int? cityID, PagingParameter pagingParams);

        /// <summary>
        ///     获取系列活动主活动数据
        /// </summary>
        /// <returns></returns>
        IList<EventsModel> GetSeriesMainEvents();

        /// <summary>
        ///     获取活动ID为eventsID的活动的相关活动数据
        /// </summary>
        /// <param name="eventsID"></param>
        /// <returns></returns>
        IList<EventsModel> GetEventsModelsByEventsIDs(IList<int?> ids);

        /// <summary>
        ///     获取活动ID为eventsID的活动的系列活动数据
        /// </summary>
        /// <param name="eventsID"></param>
        /// <returns></returns>
        IList<EventsModel> GetSeriesEvents(int? eventsID, bool includeSelf);

        /// <summary>
        ///     获取指定日期范围内的有活动要举办的城市数据
        /// </summary>
        /// <returns></returns>
        IList<DictionaryManageModel> GetEventsCitiesByYearMonth(string yearMonth);

        /*修改人：穆凤凤
       * 修改时间：2012-04-17
       * 修改内容：
       *      新增接口 获得"赞"活动的有关信息,多表查询得到
       *      有mff注释的为本次修改的代码
       */
        //mff
        /// <summary>
        ///     获得"赞"活动的有关信息的所有记录,若传入的参数不为空,则根据参数获得符合条件的记录
        /// </summary>
        /// <returns></returns>
        //DataTable getEventPraiseCount(int? langID,int? memberID);
        PagingList GetEventsByCityID(int CityID, PagingParameter pagingParams);
        PagingList GetEventsByCityIDAndArtID(int CityID, int artID, PagingParameter pagingParams);
        PagingList GetEventsByCityAndDate(int CityID, string yymm, PagingParameter pagingParams);

        

        IList<int> GetEventsDayInPeriod(string startDate, string endDate);

        IList<string> GetAllPublishedEventsYearMonth(int cityID, int artFormID);

        IList<EventsModel> GetRelatedEvents(int? eventsID, PagingParameter pagingParams);

        IList<ArtFormModel> GetAllPublishedEventsArtForms(int cityID);

        IList<int> GetAllPublishedEventsDate(int cityID, int artFormID, string yearMonth);

        PagingList GetMyEvents(int userID, PagingParameter pagingParams);
        PagingList GetMyEvents(int userID, PagingParameter pagingParams,int city);

        PagingDataSet getEventPraiseCount(int? langID, int? memberID, int? CurrentPageIndex, int? PageSize);

        PagingDataSet getUpEventByUserID(int? langID, int? userID, int? currentPageIndex, int? pageSize);
        #endregion

        #region 操作数据接口
        /// <summary>
        ///     保存活动数据
        /// </summary>
        /// <param name="modelInfo">活动数据对象</param>
        /// <returns>
        ///     通过判断ResultInfo.Result为true还是false获取保存是否成功
        ///     如果ResultInfo.Result为true，可以通过ResultInfo.ReturnedObject获取modelInfo
        ///     如果ResultInfo.Result为false，可以通过ResultInfo.Message获取错误提示，通过ResultInfo.Exception获取异常信息
        /// </returns>
        ResultInfo Save(EventsModel modelInfo);
        
        
        /// <summary>
        ///     根据活动ID删除活动数据
        /// </summary>
        /// <param name="id">活动ID</param>
        /// <returns>
        ///     通过判断ResultInfo.Result为true还是false获取删除是否成功
        ///     如果ResultInfo.Result为false，可以通过ResultInfo.Message获取错误提示，通过ResultInfo.Exception获取异常信息
        /// </returns>
        ResultInfo Delete(IList<int?> idList);

        /// <summary>
        ///     根据活动id列表将活动置为已发布状态
        /// </summary>
        /// <param name="idList">活动ID列表</param>
        /// <returns></returns>
        ResultInfo Publish(IList<int?> idList);

        /// <summary>
        ///     根据活动id列表将活动置为未发布状态
        /// </summary>
        /// <param name="idList">活动ID列表</param>
        /// <returns></returns>
        ResultInfo UnPublish(IList<int?> idList);

        /// <summary>
        ///     根据活动id列表将活动置为是特色活动
        /// </summary>
        /// <param name="idList">活动ID列表</param>
        /// <returns></returns>
        ResultInfo SetIsSpecial(IList<int?> idList);

        /// <summary>
        ///     根据活动id列表将活动置为未发布状态
        /// </summary>
        /// <param name="idList">活动ID列表</param>
        /// <returns></returns>
        ResultInfo SetNotSpecial(IList<int?> idList);
        IList<FavoriteEventsModel> GetMyEvents(int memberid, string begintime, string endtime, bool flag);

        DataTable GetAllList();

        /// <summary>
        /// 获取特色活动分页
        /// </summary>
        /// <param name="pagingParams">分页参数类</param>
        /// <returns>返回PagingList</returns>
        PagingList GetFeaturedModel(PagingParameter pagingParams);

        bool CheckMyEvents(int memberid);

        /// <summary>
        /// 根据会员取收藏并设为提醒的活动列表，没有去重
        /// </summary>
        /// <param name="memberid"></param>
        /// <returns></returns>
        IList<FavoriteEventsModelExt> GetMyRecentlyEvent(int memberid);

        #endregion

        /// <summary>
        /// 用户是否赞过
        /// </summary>
        /// <param name="memberid"></param>
        /// <param name="eventid"></param>
        /// <returns></returns>
        bool CheckUserUp(int memberid, int eventid);

        #region 后台专用
        IList<EventsModel> AfterGetAllEventsModels();
        IList<EventsModel> AfterGetAllEventsModels(int isSpecial);
        IList<EventsModel> AfterGetEventsModelByName(string ename, int? state, int? isspecial);
        #endregion

        /// <summary>
        /// 验证活动是否举行
        /// </summary>
        /// <param name="eventid"></param>
        /// <returns></returns>
        bool CheckEventBegin(int eventid);

        /// <summary>
        /// 验证用户是否收藏过活动
        /// </summary>
        /// <param name="memberid"></param>
        /// <param name="eventid"></param>
        /// <returns></returns>
        int CheckUserFavEvent(int memberid, int eventid);

        /// <summary>
        /// 用于查看数据
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        DataSet GDataSet(string sql);

        /// <summary>
        /// 最活动的最近举办日期
        /// </summary>
        /// <returns></returns>
        IList<EventBeginDate> GBeginDates();

        #region 新加的用于手机接口 2012-5-3 李学明
        PagingList GetEventsByCityIDPhoneInterface(int CityID, PagingParameter pagingParams);
        PagingList GetEventsByCityIDAndArtIDPhoneInterface(int CityID, int artID, PagingParameter pagingParams);
        PagingList GetEventsByCityAndDatePhoneInterface(int CityID, string yymm, PagingParameter pagingParams);
        #endregion

        IList<UserEventList> GetUserEventlist(PagingParameter pagingParams, out int iTotalPage, out int iTotalRow);
    }
}
